Function Reference

_GUICtrlComboSetEditSel

Select characters in the edit control of a combo box

#Include <GuiCombo.au3>
_GUICtrlComboSetEditSel($h_combobox, $i_start, $i_stop)

 

Parameters

$h_combobox control id/control hWnd
$i_start starting position
$i_stop ending position

 

Return Value

Success: Returns TRUE.
Failure: Returns $CB_ERR if the message is sent to a combo box with the $CBS_DROPDOWNLIST style.
Returns $CB_ERRSPACE if there is insufficient space to store the new strings.

 

Remarks

The positions are zero-based.

The first character of the edit control is in the zero position.

The first character after the last selected character is in the ending position.

For example, to select the first four characters of the edit control,
use a starting position of 0 and an ending position of 4

 

Related

_GUICtrlComboGetLBTextLen

 

Example


#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$Btn_Exit,$msg,$Btn_Sel

GuiCreate("ComboBox Set Edit Sel", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 100,$CBS_SIMPLE)
GUICtrlSetData($Combo,"AutoIt|v3|is|freeware|BASIC-like|scripting|language","freeware")
$Btn_Sel = GUICtrlCreateButton("Select 1st 4 chars",150,150,90,30)
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 200, 90, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
        Case $msg = $Btn_Sel
            _GUICtrlComboSetEditSel($Combo,0,4)
    EndSelect
WEnd
Exit